//
//  KLHeader.h
//  KeleAppProject
//
//  Created by 周岑 on 2018/1/11.
//  Copyright © 2018年 Cen Zhou. All rights reserved.
//

#ifndef KLHeader_h
#define KLHeader_h

#define LCAppDelegate ((AppDelegate*)[[UIApplication sharedApplication] delegate])
#define navHeight 64

#import "KLColor.h"


#define urlHost @""  // vip模块的地址

// 设备
#define iPhone6Plus ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1242, 2208), [[UIScreen mainScreen] currentMode].size) : NO)
#define iPhone6 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(750, 1334), [[UIScreen mainScreen] currentMode].size) : NO)
#define iPhone5 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO)
#define iPhone4 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 960), [[UIScreen mainScreen] currentMode].size) : NO)

#pragma mark - 屏幕尺寸
#define kIphone4        ([[UIScreen mainScreen] bounds].size.height == 480.f)
#define kIphone5        ([[UIScreen mainScreen] bounds].size.height == 568.f)
#define kIphone6        ([[UIScreen mainScreen] bounds].size.height == 667.f)
#define kIphone6p       ([[UIScreen mainScreen] bounds].size.height == 736.f)

//空字符串
#define NULLString(string) ((![string isKindOfClass:[NSString class]])||[string isEqualToString:@""] || (string == nil) || [string isEqualToString:@""] || [string isKindOfClass:[NSNull class]]||[[string stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]] length]==0)


//版本号
#define APPVersion [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]

// 系统版本

#define IOS7_OR_LATER NLSystemVersionGreaterOrEqualThan(7.0)
#define IOS7 ([[[UIDevice currentDevice]systemVersion] floatValue] >= 7.0)
#define IOS_VERSION [[[UIDevice currentDevice] systemVersion] floatValue]
#define SYSTEM_VERSION [[UIDevice currentDevice].systemVersion doubleValue]
#define IOS9 (([[[UIDevice currentDevice]systemVersion] floatValue] >= 9.0))
#define iOS8 (([[[UIDevice currentDevice]systemVersion] floatValue] >= 8.0))

#define ARRAY_SIZE(a) sizeof(a)/sizeof(a[0])

//版本号
#define MyVersion @"V 1.0"

#endif /* KLHeader_h */


// 颜色
#define KLColor(r, g, b, a) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:a]
// 随机色
#define KLRandomColor KLColor(arc4random_uniform(256), arc4random_uniform(256), arc4random_uniform(256), 1.0)

#define IndexColor KLD_color(0xf4f4f4)

// 屏幕尺寸
#define KLScreenW  [UIScreen mainScreen].bounds.size.width
#define KLScreenH  [UIScreen mainScreen].bounds.size.height

#define HEIGHT   [[UIScreen mainScreen] bounds].size.height/667
#define WIDTH    [UIScreen mainScreen].bounds.size.width / 375

#define KNavDefineW(array,w,d) ((array.count - 1) * d + array.count * w)*WIDTH

#define pageMenuH 40
#define TabbarH 48
#define NaviH (KLScreenH == 812 ? 88 : 64) // 812是iPhoneX的高度
#define scrollViewHeight (KLScreenH-NaviH-pageMenuH)

// 左控制器的View显示时，右控制器显示的宽度
#define KLRightWith 64

// 左边菜单显示的最大宽度
#define LeftMaxWidth KLScreenW - KLRightWith

// 首页边距
#define indexMargin 15
// 首页scrollview边距
#define indexScrollMargin 45
// 判断邮箱是否合法
//#define IsEmail(email)             [XJDMobileTool isValidateEmail:email]
//  唯一识别码uuid
#define UUID                       [[[UIDevice currentDevice] identifierForVendor] UUIDString]
//  唯一识设备ip地址
#define IP                         [GetIPAddress getIPAddress]


//用于登录密码加密的盐
//#define Salt                       @"cv34fsVKdjh*#HJkd;782313sab4Fb$2"


#define PageNum 15
#define PageNumStr @"15"
#define AcountLogin  @"账户密码登录"
#define PhoneLogin  @"手机快捷登录"


#define LOGIN  @"login"

#define SessionID                   [[NSUserDefaults standardUserDefaults] objectForKey:@"sessionId"]
#define UserID                      [[NSUserDefaults standardUserDefaults] objectForKey:@"userId"]


//  获取设备纬度
//#define GetLatitude               [[NSUserDefaults standardUserDefaults] objectForKey:@"XJD_Latitude"]
////  获取设备经度
//#define GetLongitude              [[NSUserDefaults standardUserDefaults] objectForKey:@"XJD_Longitude"]
//  读取userID
//#define XJD_UserID                [[NSUserDefaults standardUserDefaults] objectForKey:@"XJD_UserId"]
////  读取sessionId
//#define XJD_SessionId             [[NSUserDefaults standardUserDefaults] objectForKey:@"XJD_SessionId"]
////  读取注册手机号
//#define XJD_UserPhoneNum          [[NSUserDefaults standardUserDefaults] objectForKey:@"XJD_UserPhoneNum"]
////  用户注册验证码倒计时记录
//#define XJD_UserPhoneCodeCount    [[NSUserDefaults standardUserDefaults] objectForKey:@"XJD_UserPhoneCodeCount"]
//
//// 读取是否是会员状态
//#define XJD_IsVip                 [[NSUserDefaults standardUserDefaults] boolForKey:@"isVip"]


#pragma mark   -----------------KLColor 一级------------------
#define KLColor_A1   [KLColor colorWithHexString:@"#E24641"]   // 主色

#define KLColor_B1   [KLColor colorWithHexString:@"#FF8000"]  // 辅色

#define KLColor_C1   [KLColor colorWithHexString:@"#F4F5F6"]  // 默写背景色

#pragma mark   -----------------KLColor 二级------------------

#define KLColor_A2   [KLColor colorWithHexString:@"#DF433E"]   // butotn 颜色
#define KLColor_A3   [KLColor colorWithHexString:@"#4D4D4D"]   // 底部tabbaritem的未点击颜色
#define KLColor_A4   [KLColor colorWithHexString:@"#319AC1"]
#define KLColor_A5   [KLColor colorWithHexString:@"#FF9500"]
#define KLColor_A6   [KLColor colorWithHexString:@"#FD8383"]
#define KLColor_A7   [KLColor colorWithHexString:@"#42C48B"]
#define KLColor_A8   [KLColor colorWithHexString:@"#F2F4F5"]   // 字体颜色辉
#define KLColor_A9   [KLColor colorWithHexString:@"#F5F5F5"]   // 字体颜色辉

#pragma mark   -----------------KLColor 二级------------------


#define KLColor_B2  [KLColor colorWithHexString:@"#1A1A1A"]   // 字体颜色
#define KLColor_B3  [KLColor colorWithHexString:@"#EBEBEB"]   // 线的颜色
#define KLColor_B4  [KLColor colorWithHexString:@"#B3B3B3"]   // 协议灰色
#define KLColor_B5  [KLColor colorWithHexString:@"#808080"]   // 导航栏辉
#define KLColor_B6  [KLColor colorWithHexString:@"#000000"]   // 字体黑色
#define KLColor_B7  [KLColor colorWithHexString:@"#666666"]   // 字体颜色辉
#define KLColor_B8  [KLColor colorWithHexString:@"#999999"]   // 字体颜色辉
#define KLColor_B9  [KLColor colorWithHexString:@"#030303"]   // 字体颜色辉
#define KLColor_B10  [KLColor colorWithHexString:@"#E6E6E6"]   // 字体颜色辉
#define KLColor_B11  [KLColor colorWithHexString:@"#FF8000"]   // 字体颜色辉
#define KLColor_B12  [KLColor colorWithHexString:@"#333333"]   // 字体颜色辉






#define sizeScale 0.85






